package com.dearbinge.data.dao;

import com.baomidou.mybatisplus.plugins.Page;
import com.dearbinge.data.pojo.orderTable.OrderTable;

import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderTableMapper {
    Integer update(OrderTable orderTable);

    Integer insert(OrderTable orderTable);

    Integer delete(Integer id);

    Integer count(@Param("userType") String userType,@Param("orderId") String orderId,@Param("userId") String userId,@Param("orderStatus") Integer orderStatus,@Param("assessType") Integer assessType,@Param("isDeleted")Integer isDeleted, Page page);

    List<Map<String,Object>> getPage(@Param("userType") String userType,@Param("orderId") String orderId,@Param("userId") String userId,@Param("orderStatus") Integer orderStatus,@Param("assessType") Integer assessType,@Param("isDeleted")Integer isDeleted, Page page);

    List<Map<String , String>> getCommodityByUserId(@Param("userId") String userId, Page page);

    List<Map<String, Object>> getCommodity(@Param("type")String type,@Param("orderId")String orderId);

    Map<String, Object> getByUserId(String orderId);

    Integer updateStatus(@Param("orderNum") String orderNum,@Param("orderStatus") Integer orderStatus);

    Integer deliverGoods(@Param("expressNum")String expressNum,@Param("orderNum")String orderNum,@Param("orderCompanyCode")String orderCompanyCode,@Param("orderStatus")String orderStatus,@Param("expressName")String expressName);

    List<Object> getCommodityByOrderNo(@Param("orderNum")String orderNum);

    Integer updateStatusByWechatNumber(@Param("orderNum") String orderNum,@Param("orderStatus") Integer orderStatus);

    BigDecimal selectTotalMonryByWechatNumber(@Param("orderNum") String wechatNumber);

    /**
     * 根据id查询
     * @param id id
     * @return 订单对象
     */
    OrderTable getById(Integer id);

    /**
     * 根据订单编号查询
     * @param orderNumber orderNumber
     * @return 订单对象
     */
    OrderTable getByNumber(String orderNumber);

    /**
     * 是否评价（0：未评价  1：已评价 2：已追评）
     * @param assessType
     * @param id 订单id
     * @return 影响行数
     */
    Integer updateAssessType(@Param("assessType") Integer assessType,@Param("id") Integer id);
}
